#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from cogen.core import sockets
from cogen.core import schedulers
from cogen.core.coroutines import coroutine
from cogen.core import proactors


__sd=schedulers.Scheduler()

def add(f, args=(), kwargs={}):
    """
    增加函数进入到队列
    
    f -- 函数名
    args -- 参数
    kwargs -- 参数
    """
    f=coroutine(f)
    __sd.add(f,args,kwargs)


__sd.run()

def main():

    def xx(x):
        print x
        yield

    add(xx,(1,))

main()
